<?php

namespace App\Models;

use App\Models\Traits\CategoryHotTags;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    use HasFactory;
    use CategoryHotTags;

    protected $fillable = ['title', 'description', 'slug'];

    /**
     * 获取该模型的路由的自定义键名
     *
     * @return string
     */
    public function getRouteKeyName()
    {
        return 'slug';
    }

    public function getHotTagsAttribute()
    {
        return $this->getHotTags();
    }
}
